﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_Comment_Manage : System.Web.UI.Page
{
    public int CID
    {
        get { return Convert.ToInt32(ViewState["_CID"]); }
        set { ViewState["_CID"] = value; }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            CID = DongDong.Common.Misc.GetQueryStringAsInt("CID");
            GetDrpDownValue();
         
        }

    }

    public void PopulateComment()
    {
        //int chanpinID = DongDong.Common.Misc.ConvertToInt(drpChanPin.SelectedValue);
        //if (chanpinID == 0)
        //    chanpinID = CID;
        //Lv_PingLun.DataSource = LiuYan.GetAllLiuYanByRelationID_TypeID(CID, DongDong.Common.Misc.ConvertToInt(drpUser.SelectedValue), txtTimeFrom.Text, txtTimeTo.Text, txtKey.Text);
        //Lv_PingLun.DataBind();
    }
    protected void btn_search_Click_Click(object sender, EventArgs e)
    {
      PopulateComment();
    }

    public void GetDrpDownValue()
    {
        //drpChanPin.DataSource = Product.GetAll();
        //drpChanPin.DataValueField = "ID";
        //drpChanPin.DataTextField = "Title";
        //drpChanPin.DataBind();
        drpChanPin.Items.Insert(0, new ListItem("请选择", "0"));

        drpUser.DataSource = Client.GetAll();
        drpUser.DataValueField = "ID";
        drpUser.DataTextField = "Username";
        drpUser.DataBind();
        drpUser.Items.Insert(0, new ListItem("请选择", "0"));

    }
    protected void Lv_PingLun_PagePropertiesChanged(object sender, EventArgs e)
    {
       PopulateComment();
    }
    protected void Pager_PreRender(object sender, EventArgs e)
    {
        PopulateComment();
    }
    protected void Lv_PingLun_ItemDeleting(object sender, ListViewDeleteEventArgs e)
    {
        //Comment.Delete(DongDong.Common.Misc.ConvertToInt(Lv_PingLun.DataKeys[e.ItemIndex].Value));
        PopulateComment();
    }
}